﻿using System.ComponentModel;
using System.Configuration;

namespace Common
{
    public static class Variables
    {
        public const string LogPathFile = "~/ErrorLog.txt";
        public const string GlossaryPath = @".\Resource\Glossary.resx";

        public const string PROC_METADATA_SQL = "select replace(p.name,'@','') as ParamName, t.name as DataType, p.is_output as IsOutput, " +
                                                "p.has_default_value as IsDefault, default_value as DefaultValue " +
                                                "from sys.parameters p inner join sys.objects o on p.object_id = o.object_id " +
                                                "inner join sys.types t on p.user_type_id = t.user_type_id where o.name = '{0}'";

        public const int ERROR = -1;
        public const int VIEWED = 0;
        public const int INSERTED = 1;
        public const int UPDATED = 2;
        public const int DELETED = 3;
        public const int SUCCEED = 4;
        
        [DefaultValue(LANGUAGE.VIETNAMESE)]
        public static LANGUAGE Language { get; set; }

        public static int TimeOut
        {
            get
            {
                int timeOut = 60;
                if (!int.TryParse(ConfigurationSettings.AppSettings["CommandTimeOut"], out timeOut)) timeOut = 60;
                return timeOut;
            }
        }
    }
}
